<template>
  <div class="app-container">
<!--    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
<!--      <el-form-item label="场站名称" prop="companyName">-->
<!--        <el-input-->
<!--          v-model="queryParams.companyName"-->
<!--          placeholder="请输入场站名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="社会统一信用代码" prop="unifiedSocialCode">-->
<!--        <el-input-->
<!--          v-model="queryParams.unifiedSocialCode"-->
<!--          placeholder="请输入社会统一信用代码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="公司法人" prop="companyLegaler">-->
<!--        <el-input-->
<!--          v-model="queryParams.companyLegaler"-->
<!--          placeholder="请输入公司法人"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="主营业务" prop="coreBusiness">-->
<!--        <el-input-->
<!--          v-model="queryParams.coreBusiness"-->
<!--          placeholder="请输入主营业务"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="注册日期" prop="registerDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.registerDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择注册日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="注册地址" prop="registerAddress">-->
<!--        <el-input-->
<!--          v-model="queryParams.registerAddress"-->
<!--          placeholder="请输入注册地址"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="办公地址" prop="address">-->
<!--        <el-input-->
<!--          v-model="queryParams.address"-->
<!--          placeholder="请输入办公地址"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="办公地址经度" prop="longitude">-->
<!--        <el-input-->
<!--          v-model="queryParams.longitude"-->
<!--          placeholder="请输入办公地址经度"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="办公地址纬度" prop="latitude">-->
<!--        <el-input-->
<!--          v-model="queryParams.latitude"-->
<!--          placeholder="请输入办公地址纬度"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="所属园区id" prop="belongParkId">-->
<!--        <el-input-->
<!--          v-model="queryParams.belongParkId"-->
<!--          placeholder="请输入所属园区id"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="所属园区名称" prop="belongParkName">-->
<!--        <el-input-->
<!--          v-model="queryParams.belongParkName"-->
<!--          placeholder="请输入所属园区名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="企业人数" prop="companyEmployees">-->
<!--        <el-input-->
<!--          v-model="queryParams.companyEmployees"-->
<!--          placeholder="请输入企业人数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="企业负责人" prop="manager">-->
<!--        <el-input-->
<!--          v-model="queryParams.manager"-->
<!--          placeholder="请输入企业负责人"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="企业负责人联系方式" prop="managerContact">-->
<!--        <el-input-->
<!--          v-model="queryParams.managerContact"-->
<!--          placeholder="请输入企业负责人联系方式"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="是否规上企业" prop="largeScale">-->
<!--        <el-input-->
<!--          v-model="queryParams.largeScale"-->
<!--          placeholder="请输入是否规上企业"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="" prop="fileList1">-->
<!--        <el-input-->
<!--          v-model="queryParams.fileList1"-->
<!--          placeholder="请输入"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="" prop="fileList2">-->
<!--        <el-input-->
<!--          v-model="queryParams.fileList2"-->
<!--          placeholder="请输入"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="普通车总数" prop="normalCarNum">-->
<!--        <el-input-->
<!--          v-model="queryParams.normalCarNum"-->
<!--          placeholder="请输入普通车总数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="普通车总数" prop="normalCarWeight">-->
<!--        <el-input-->
<!--          v-model="queryParams.normalCarWeight"-->
<!--          placeholder="请输入普通车总数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="冷藏车总数" prop="freezCarNum">-->
<!--        <el-input-->
<!--          v-model="queryParams.freezCarNum"-->
<!--          placeholder="请输入冷藏车总数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="冷藏车总数" prop="freezCarWeight">-->
<!--        <el-input-->
<!--          v-model="queryParams.freezCarWeight"-->
<!--          placeholder="请输入冷藏车总数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="普通车总数" prop="dangerousCarNum">-->
<!--        <el-input-->
<!--          v-model="queryParams.dangerousCarNum"-->
<!--          placeholder="请输入普通车总数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="普通车总数" prop="dangerousCarWeight">-->
<!--        <el-input-->
<!--          v-model="queryParams.dangerousCarWeight"-->
<!--          placeholder="请输入普通车总数"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="数据来源" prop="dataSources">-->
<!--        <el-input-->
<!--          v-model="queryParams.dataSources"-->
<!--          placeholder="请输入数据来源"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="企业综合能力评估等级" prop="companyLevel">-->
<!--        <el-input-->
<!--          v-model="queryParams.companyLevel"-->
<!--          placeholder="请输入企业综合能力评估等级"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="收集日期" prop="collectDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.collectDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择收集日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item>-->
<!--        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!--      </el-form-item>-->
<!--    </el-form>-->
<!--    <el-row :gutter="10" class="mb8">-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          plain-->
<!--          icon="el-icon-plus"-->
<!--          size="mini"-->
<!--          @click="handleAdd"-->
<!--          v-hasPermi="['reportInfo:logisticsCompany:add']"-->
<!--        >新增</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="success"-->
<!--          plain-->
<!--          icon="el-icon-edit"-->
<!--          size="mini"-->
<!--          :disabled="single"-->
<!--          @click="handleUpdate"-->
<!--          v-hasPermi="['reportInfo:logisticsCompany:edit']"-->
<!--        >修改</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="danger"-->
<!--          plain-->
<!--          icon="el-icon-delete"-->
<!--          size="mini"-->
<!--          :disabled="multiple"-->
<!--          @click="handleDelete"-->
<!--          v-hasPermi="['reportInfo:logisticsCompany:remove']"-->
<!--        >删除</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['reportInfo:logisticsCompany:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
<!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!--    </el-row>-->

    <el-table v-loading="loading" :data="logisticsCompanyList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键id" align="center" prop="id" v-if="true"/>
      <el-table-column label="场站名称" align="center" prop="companyName" />
      <el-table-column label="社会统一信用代码" align="center" prop="unifiedSocialCode" />
      <el-table-column label="公司法人" align="center" prop="companyLegaler" />
      <el-table-column label="企业类型" align="center" prop="companyType" />
      <el-table-column label="主营业务" align="center" prop="coreBusiness" />
      <el-table-column label="注册日期" align="center" prop="registerDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.registerDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="注册地址" align="center" prop="registerAddress" />
      <el-table-column label="办公地址" align="center" prop="address" />
      <el-table-column label="办公地址经度" align="center" prop="longitude" />
      <el-table-column label="办公地址纬度" align="center" prop="latitude" />
      <el-table-column label="所属园区id" align="center" prop="belongParkId" />
      <el-table-column label="所属园区名称" align="center" prop="belongParkName" />
      <el-table-column label="企业人数" align="center" prop="companyEmployees" />
      <el-table-column label="企业负责人" align="center" prop="manager" />
      <el-table-column label="企业负责人联系方式" align="center" prop="managerContact" />
      <el-table-column label="是否规上企业" align="center" prop="largeScale" />
      <el-table-column label="" align="center" prop="fileList1" />
      <el-table-column label="" align="center" prop="fileList2" />
      <el-table-column label="普通车总数" align="center" prop="normalCarNum" />
      <el-table-column label="普通车总数" align="center" prop="normalCarWeight" />
      <el-table-column label="冷藏车总数" align="center" prop="freezCarNum" />
      <el-table-column label="冷藏车总数" align="center" prop="freezCarWeight" />
      <el-table-column label="普通车总数" align="center" prop="dangerousCarNum" />
      <el-table-column label="普通车总数" align="center" prop="dangerousCarWeight" />
      <el-table-column label="数据状态" align="center" prop="dataStatus" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="数据来源" align="center" prop="dataSources" />
      <el-table-column label="企业综合能力评估等级" align="center" prop="companyLevel" />
      <el-table-column label="收集日期" align="center" prop="collectDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.collectDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['reportInfo:logisticsCompany:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['reportInfo:logisticsCompany:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改物流企业信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="场站名称" prop="companyName">
          <el-input v-model="form.companyName" placeholder="请输入场站名称" />
        </el-form-item>
        <el-form-item label="社会统一信用代码" prop="unifiedSocialCode">
          <el-input v-model="form.unifiedSocialCode" placeholder="请输入社会统一信用代码" />
        </el-form-item>
        <el-form-item label="公司法人" prop="companyLegaler">
          <el-input v-model="form.companyLegaler" placeholder="请输入公司法人" />
        </el-form-item>
        <el-form-item label="主营业务" prop="coreBusiness">
          <el-input v-model="form.coreBusiness" placeholder="请输入主营业务" />
        </el-form-item>
        <el-form-item label="注册日期" prop="registerDate">
          <el-date-picker clearable
            v-model="form.registerDate"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择注册日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="注册地址" prop="registerAddress">
          <el-input v-model="form.registerAddress" placeholder="请输入注册地址" />
        </el-form-item>
        <el-form-item label="办公地址" prop="address">
          <el-input v-model="form.address" placeholder="请输入办公地址" />
        </el-form-item>
        <el-form-item label="办公地址经度" prop="longitude">
          <el-input v-model="form.longitude" placeholder="请输入办公地址经度" />
        </el-form-item>
        <el-form-item label="办公地址纬度" prop="latitude">
          <el-input v-model="form.latitude" placeholder="请输入办公地址纬度" />
        </el-form-item>
        <el-form-item label="所属园区id" prop="belongParkId">
          <el-input v-model="form.belongParkId" placeholder="请输入所属园区id" />
        </el-form-item>
        <el-form-item label="所属园区名称" prop="belongParkName">
          <el-input v-model="form.belongParkName" placeholder="请输入所属园区名称" />
        </el-form-item>
        <el-form-item label="企业人数" prop="companyEmployees">
          <el-input v-model="form.companyEmployees" placeholder="请输入企业人数" />
        </el-form-item>
        <el-form-item label="企业负责人" prop="manager">
          <el-input v-model="form.manager" placeholder="请输入企业负责人" />
        </el-form-item>
        <el-form-item label="企业负责人联系方式" prop="managerContact">
          <el-input v-model="form.managerContact" placeholder="请输入企业负责人联系方式" />
        </el-form-item>
        <el-form-item label="是否规上企业" prop="largeScale">
          <el-input v-model="form.largeScale" placeholder="请输入是否规上企业" />
        </el-form-item>
        <el-form-item label="" prop="fileList1">
          <el-input v-model="form.fileList1" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="" prop="fileList2">
          <el-input v-model="form.fileList2" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="普通车总数" prop="normalCarNum">
          <el-input v-model="form.normalCarNum" placeholder="请输入普通车总数" />
        </el-form-item>
        <el-form-item label="普通车总数" prop="normalCarWeight">
          <el-input v-model="form.normalCarWeight" placeholder="请输入普通车总数" />
        </el-form-item>
        <el-form-item label="冷藏车总数" prop="freezCarNum">
          <el-input v-model="form.freezCarNum" placeholder="请输入冷藏车总数" />
        </el-form-item>
        <el-form-item label="冷藏车总数" prop="freezCarWeight">
          <el-input v-model="form.freezCarWeight" placeholder="请输入冷藏车总数" />
        </el-form-item>
        <el-form-item label="普通车总数" prop="dangerousCarNum">
          <el-input v-model="form.dangerousCarNum" placeholder="请输入普通车总数" />
        </el-form-item>
        <el-form-item label="普通车总数" prop="dangerousCarWeight">
          <el-input v-model="form.dangerousCarWeight" placeholder="请输入普通车总数" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="数据来源" prop="dataSources">
          <el-input v-model="form.dataSources" placeholder="请输入数据来源" />
        </el-form-item>
        <el-form-item label="企业综合能力评估等级" prop="companyLevel">
          <el-input v-model="form.companyLevel" placeholder="请输入企业综合能力评估等级" />
        </el-form-item>
        <el-form-item label="收集日期" prop="collectDate">
          <el-date-picker clearable
            v-model="form.collectDate"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择收集日期">
          </el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listLogisticsCompany, getLogisticsCompany, delLogisticsCompany, addLogisticsCompany, updateLogisticsCompany } from "@/api/reportInfo/logisticsCompany";

export default {
  name: "LogisticsCompany",
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 物流企业信息表格数据
      logisticsCompanyList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        companyName: undefined,
        unifiedSocialCode: undefined,
        companyLegaler: undefined,
        companyType: undefined,
        coreBusiness: undefined,
        registerDate: undefined,
        registerAddress: undefined,
        address: undefined,
        longitude: undefined,
        latitude: undefined,
        belongParkId: undefined,
        belongParkName: undefined,
        companyEmployees: undefined,
        manager: undefined,
        managerContact: undefined,
        largeScale: undefined,
        fileList1: undefined,
        fileList2: undefined,
        normalCarNum: undefined,
        normalCarWeight: undefined,
        freezCarNum: undefined,
        freezCarWeight: undefined,
        dangerousCarNum: undefined,
        dangerousCarWeight: undefined,
        dataStatus: undefined,
        dataSources: undefined,
        companyLevel: undefined,
        collectDate: undefined
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        id: [
          { required: true, message: "主键id不能为空", trigger: "blur" }
        ],
        companyName: [
          { required: true, message: "场站名称不能为空", trigger: "blur" }
        ],
        unifiedSocialCode: [
          { required: true, message: "社会统一信用代码不能为空", trigger: "blur" }
        ],
        companyLegaler: [
          { required: true, message: "公司法人不能为空", trigger: "blur" }
        ],
        companyType: [
          { required: true, message: "企业类型不能为空", trigger: "change" }
        ],
        coreBusiness: [
          { required: true, message: "主营业务不能为空", trigger: "blur" }
        ],
        registerDate: [
          { required: true, message: "注册日期不能为空", trigger: "blur" }
        ],
        registerAddress: [
          { required: true, message: "注册地址不能为空", trigger: "blur" }
        ],
        address: [
          { required: true, message: "办公地址不能为空", trigger: "blur" }
        ],
        longitude: [
          { required: true, message: "办公地址经度不能为空", trigger: "blur" }
        ],
        latitude: [
          { required: true, message: "办公地址纬度不能为空", trigger: "blur" }
        ],
        belongParkId: [
          { required: true, message: "所属园区id不能为空", trigger: "blur" }
        ],
        belongParkName: [
          { required: true, message: "所属园区名称不能为空", trigger: "blur" }
        ],
        companyEmployees: [
          { required: true, message: "企业人数不能为空", trigger: "blur" }
        ],
        manager: [
          { required: true, message: "企业负责人不能为空", trigger: "blur" }
        ],
        managerContact: [
          { required: true, message: "企业负责人联系方式不能为空", trigger: "blur" }
        ],
        largeScale: [
          { required: true, message: "是否规上企业不能为空", trigger: "blur" }
        ],
        fileList1: [
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        fileList2: [
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        normalCarNum: [
          { required: true, message: "普通车总数不能为空", trigger: "blur" }
        ],
        normalCarWeight: [
          { required: true, message: "普通车总数不能为空", trigger: "blur" }
        ],
        freezCarNum: [
          { required: true, message: "冷藏车总数不能为空", trigger: "blur" }
        ],
        freezCarWeight: [
          { required: true, message: "冷藏车总数不能为空", trigger: "blur" }
        ],
        dangerousCarNum: [
          { required: true, message: "普通车总数不能为空", trigger: "blur" }
        ],
        dangerousCarWeight: [
          { required: true, message: "普通车总数不能为空", trigger: "blur" }
        ],
        dataStatus: [
          { required: true, message: "数据状态不能为空", trigger: "change" }
        ],
        remark: [
          { required: true, message: "备注不能为空", trigger: "blur" }
        ],
        dataSources: [
          { required: true, message: "数据来源不能为空", trigger: "blur" }
        ],
        companyLevel: [
          { required: true, message: "企业综合能力评估等级不能为空", trigger: "blur" }
        ],
        collectDate: [
          { required: true, message: "收集日期不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询物流企业信息列表 */
    getList() {
      this.loading = true;
      listLogisticsCompany(this.queryParams).then(response => {
        this.logisticsCompanyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        companyName: undefined,
        unifiedSocialCode: undefined,
        companyLegaler: undefined,
        companyType: undefined,
        coreBusiness: undefined,
        registerDate: undefined,
        registerAddress: undefined,
        address: undefined,
        longitude: undefined,
        latitude: undefined,
        belongParkId: undefined,
        belongParkName: undefined,
        companyEmployees: undefined,
        manager: undefined,
        managerContact: undefined,
        largeScale: undefined,
        fileList1: undefined,
        fileList2: undefined,
        normalCarNum: undefined,
        normalCarWeight: undefined,
        freezCarNum: undefined,
        freezCarWeight: undefined,
        dangerousCarNum: undefined,
        dangerousCarWeight: undefined,
        dataStatus: undefined,
        delFlag: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined,
        remark: undefined,
        dataSources: undefined,
        companyLevel: undefined,
        collectDate: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加物流企业信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getLogisticsCompany(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改物流企业信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateLogisticsCompany(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addLogisticsCompany(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除物流企业信息编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return delLogisticsCompany(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('reportInfo/logisticsCompany/export', {
        ...this.queryParams
      }, `logisticsCompany_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
